package com.jsoft.util;

import org.junit.Test;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author:sha
 * @email:o68o4741@163.com
 * @date:2023/2/19
 */
public class SetNo {
    public String addNo(String id) {
        /**
         * 截取头部字母编号
         */

        String head = id.substring(0, id.indexOf("2"));
        /**
         * 截取尾部数字
         */
        String tail = id.substring(head.length(), id.length());
        /**
         * 尾部数字 +1
         */
        Long l=Long.parseLong(tail);
        long l1 = l + 1;
        /**
         * 填充 0
         */
        String s = null;
        for (int i = 0; i <= id.length(); i++) {
            s += "0";
        }
        /**
         * 合并字符串
         */
        s = s + l1;
        s = s.substring(s.length() - tail.length(), s.length());
        return head + s;
    }
}
